<template>
  <div class="home">
    <el-row :gutter="20">
      <el-col :span="8">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>用户统计</span>
          </div>
          <div>
            <p>总用户数: 1000</p>
            <p>今日新增: 50</p>
          </div>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>海报统计</span>
          </div>
          <div>
            <p>总海报数: 500</p>
            <p>今日新增: 10</p>
          </div>
        </el-card>
      </el-col>
      <el-col :span="8">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>素材统计</span>
          </div>
          <div>
            <p>总素材数: 300</p>
            <p>今日新增: 20</p>
          </div>
        </el-card>
      </el-col>
    </el-row>
    <el-row :gutter="20" class="margin-top">
      <el-col :span="24">
        <el-card class="box-card">
          <div slot="header" class="clearfix">
            <span>操作</span>
          </div>
          <div class="buttons">
            <el-button type="primary" @click="navigateTo('user')">用户管理</el-button>
            <el-button type="primary" @click="navigateTo('poster')">海报管理</el-button>
            <el-button type="primary" @click="navigateTo('material')">素材管理</el-button>
          </div>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>

<script>
export default {
  methods: {
    navigateTo(page) {
      this.$emit('navigate', page); // 触发父组件的导航方法
    }
  }
}
</script>

<style scoped>
.home {
  padding: 20px;
}

.margin-top {
  margin-top: 20px;
}

.box-card {
  margin-bottom: 20px;
}

.buttons {
  text-align: center;
}

.buttons .el-button {
  margin: 0 10px;
}
</style>
